<?php
/*
 * Copyright 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * The Tasks service implementation
 *
 * Generated by http://code.google.com/p/google-api-php-client/
 * Generated from: https://www.googleapis.com/discovery/v0.3/describe/tasks/v1
 **/
class Task {
  public $completed;
  public $deleted;
  public $due;
  public $etag;
  public $hidden;
  public $id;
  public $kind;
  public $notes;
  public $parent;
  public $position;
  public $selfLink;
  public $status;
  public $title;
  public $updated;
}

class TaskList {
  public $etag;
  public $id;
  public $kind;
  public $selfLink;
  public $title;
}

class TaskLists {
  public $etag;
  public $items;
  public $kind;
  public $nextPageToken;
}

class Tasks {
  public $etag;
  public $items;
  public $kind;
  public $nextPageToken;
}

class apiTasksService {

  // Variables that the apiServiceResource implementation depends on
  private $serviceName = 'tasks';
  private $version = 'v1';
  private $restBasePath = '/tasks/v1/';
  private $rpcPath = '/rpc';
  private $io;
  // apiServiceResource's that are used internally
  private $tasklists;
  private $tasks;

  /**
   * Constructs the internal service representations and does the auto-magic configuration required to drive them
   */
  public function __construct(apiClient $apiClient) {
    $apiClient->addService('tasks', 'v1');
    $this->io = $apiClient->getIo();
    $this->tasklists = new apiServiceResource($this, $this->serviceName, 'tasklists', json_decode('{"methods":{"delete":{"restPath":"users\/@me\/lists\/{tasklist}","rpcMethod":"tasks.tasklists.delete","httpMethod":"DELETE","description":"Deletes the authenticated user\'s specified task list.","parameters":{"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist"],"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]},"get":{"restPath":"users\/@me\/lists\/{tasklist}","rpcMethod":"tasks.tasklists.get","httpMethod":"GET","description":"Returns the authenticated user\'s specified task list.","parameters":{"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist"],"response":{"$ref":"TaskList"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks","https:\/\/www.googleapis.com\/auth\/tasks.readonly"]},"insert":{"restPath":"users\/@me\/lists","rpcMethod":"tasks.tasklists.insert","httpMethod":"POST","description":"Creates a new task list and adds it to the authenticated user\'s task lists.","request":{"$ref":"TaskList"},"response":{"$ref":"TaskList"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]},"list":{"restPath":"users\/@me\/lists","rpcMethod":"tasks.tasklists.list","httpMethod":"GET","description":"Returns all the authenticated user\'s task lists.","parameters":{"maxResults":{"restParameterType":"query","description":"Maximum number of task lists returned on one page. Optional. The default is 100.","type":"integer","minimum":"-9223372036854775808","maximum":"9223372036854775807"},"pageToken":{"restParameterType":"query","description":"Token specifying the result page to return. Optional.","type":"string"}},"response":{"$ref":"TaskLists"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks","https:\/\/www.googleapis.com\/auth\/tasks.readonly"]},"update":{"restPath":"users\/@me\/lists\/{tasklist}","rpcMethod":"tasks.tasklists.update","httpMethod":"PUT","description":"Updates the authenticated user\'s specified task list.","parameters":{"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist"],"request":{"$ref":"TaskList"},"response":{"$ref":"TaskList"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]}}}', true));
    $this->tasks = new apiServiceResource($this, $this->serviceName, 'tasks', json_decode('{"methods":{"clear":{"restPath":"lists\/{tasklist}\/clear","rpcMethod":"tasks.tasks.clear","httpMethod":"POST","description":"Clears all completed tasks from the specified task list. The affected tasks will be marked as \'hidden\' and no longer be returned by default when retrieving all tasks for a task list.","parameters":{"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist"],"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]},"delete":{"restPath":"lists\/{tasklist}\/tasks\/{task}","rpcMethod":"tasks.tasks.delete","httpMethod":"DELETE","description":"Deletes the specified task from the task list.","parameters":{"task":{"restParameterType":"path","required":true,"description":"Task identifier.","type":"string"},"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist","task"],"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]},"get":{"restPath":"lists\/{tasklist}\/tasks\/{task}","rpcMethod":"tasks.tasks.get","httpMethod":"GET","description":"Returns the specified task.","parameters":{"task":{"restParameterType":"path","required":true,"description":"Task identifier.","type":"string"},"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist","task"],"response":{"$ref":"Task"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks","https:\/\/www.googleapis.com\/auth\/tasks.readonly"]},"insert":{"restPath":"lists\/{tasklist}\/tasks","rpcMethod":"tasks.tasks.insert","httpMethod":"POST","description":"Creates a new task on the specified task list.","parameters":{"parent":{"restParameterType":"query","description":"Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.","type":"string"},"previous":{"restParameterType":"query","description":"Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.","type":"string"},"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist"],"request":{"$ref":"Task"},"response":{"$ref":"Task"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]},"list":{"restPath":"lists\/{tasklist}\/tasks","rpcMethod":"tasks.tasks.list","httpMethod":"GET","description":"Returns all tasks in the specified task list.","parameters":{"completedMax":{"restParameterType":"query","description":"Upper bound for a task\'s completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.","type":"string"},"completedMin":{"restParameterType":"query","description":"Lower bound for a task\'s completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.","type":"string"},"dueMax":{"restParameterType":"query","description":"Upper bound for a task\'s due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.","type":"string"},"dueMin":{"restParameterType":"query","description":"Lower bound for a task\'s due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.","type":"string"},"maxResults":{"restParameterType":"query","description":"Maximum number of task lists returned on one page. Optional. The default is 100.","type":"integer","minimum":"-9223372036854775808","maximum":"9223372036854775807"},"pageToken":{"restParameterType":"query","description":"Token specifying the result page to return. Optional.","type":"string"},"showCompleted":{"restParameterType":"query","description":"Flag indicating whether completed tasks are returned in the result. Optional. The default is True.","type":"boolean"},"showDeleted":{"restParameterType":"query","description":"Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.","type":"boolean"},"showHidden":{"restParameterType":"query","description":"Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.","type":"boolean"},"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"},"updatedMin":{"restParameterType":"query","description":"Lower bound for a task\'s last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time.","type":"string"}},"parameterOrder":["tasklist"],"response":{"$ref":"Tasks"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks","https:\/\/www.googleapis.com\/auth\/tasks.readonly"]},"move":{"restPath":"lists\/{tasklist}\/tasks\/{task}\/move","rpcMethod":"tasks.tasks.move","httpMethod":"POST","description":"Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and\/or move it to a different position among its sibling tasks.","parameters":{"parent":{"restParameterType":"query","description":"New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.","type":"string"},"previous":{"restParameterType":"query","description":"New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.","type":"string"},"task":{"restParameterType":"path","required":true,"description":"Task identifier.","type":"string"},"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist","task"],"response":{"$ref":"Task"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]},"update":{"restPath":"lists\/{tasklist}\/tasks\/{task}","rpcMethod":"tasks.tasks.update","httpMethod":"PUT","description":"Updates the specified task.","parameters":{"task":{"restParameterType":"path","required":true,"description":"Task identifier.","type":"string"},"tasklist":{"restParameterType":"path","required":true,"description":"Task list identifier.","type":"string"}},"parameterOrder":["tasklist","task"],"request":{"$ref":"Task"},"response":{"$ref":"Task"},"scopes":["https:\/\/www.googleapis.com\/auth\/tasks"]}}}', true));
  }

  /**
   * Deletes the authenticated user's specified task list.
   *
   * @param $tasklist   string Task list identifier.
   */
  public function deleteTasklists($tasklist) {
    return $this->tasklists->__call('delete', array(array('tasklist' => $tasklist)));
  }

  /**
   * Returns the authenticated user's specified task list.
   *
   * @param $tasklist   string Task list identifier.
   */
  public function getTasklists($tasklist) {
    return $this->tasklists->__call('get', array(array('tasklist' => $tasklist)));
  }

  /**
   * Creates a new task list and adds it to the authenticated user's task lists.
   *
   * @param $postBody 
   */
  public function insertTasklists($postBody) {
    return $this->tasklists->__call('insert', array(array('postBody' => $postBody)));
  }

  /**
   * Returns all the authenticated user's task lists.
   *
   * @param $maxResults   integer Maximum number of task lists returned on one page. Optional. The default is 100.
   * @param $pageToken   string Token specifying the result page to return. Optional.
   */
  public function listTasklists($maxResults = null,
        $pageToken = null) {
    return $this->tasklists->__call('list', array(array('maxResults' => $maxResults,
        'pageToken' => $pageToken)));
  }

  /**
   * Updates the authenticated user's specified task list.
   *
   * @param $tasklist   string Task list identifier.
   * @param $postBody 
   */
  public function updateTasklists($tasklist,
        $postBody) {
    return $this->tasklists->__call('update', array(array('tasklist' => $tasklist,
        'postBody' => $postBody)));
  }

  /**
   * Clears all completed tasks from the specified task list. The affected tasks will be marked as 'hidden' and no longer be returned by default when retrieving all tasks for a task list.
   *
   * @param $tasklist   string Task list identifier.
   * @param $postBody 
   */
  public function clearTasks($tasklist,
        $postBody) {
    return $this->tasks->__call('clear', array(array('tasklist' => $tasklist,
        'postBody' => $postBody)));
  }

  /**
   * Deletes the specified task from the task list.
   *
   * @param $task   string Task identifier.
   * @param $tasklist   string Task list identifier.
   */
  public function deleteTasks($task,
        $tasklist) {
    return $this->tasks->__call('delete', array(array('task' => $task,
        'tasklist' => $tasklist)));
  }

  /**
   * Returns the specified task.
   *
   * @param $task   string Task identifier.
   * @param $tasklist   string Task list identifier.
   */
  public function getTasks($task,
        $tasklist) {
    return $this->tasks->__call('get', array(array('task' => $task,
        'tasklist' => $tasklist)));
  }

  /**
   * Creates a new task on the specified task list.
   *
   * @param $tasklist   string Task list identifier.
   * @param $postBody 
   * @param $parent   string Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.
   * @param $previous   string Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.
   */
  public function insertTasks($tasklist,
        $postBody,
        $parent = null,
        $previous = null) {
    return $this->tasks->__call('insert', array(array('tasklist' => $tasklist,
        'postBody' => $postBody,
        'parent' => $parent,
        'previous' => $previous)));
  }

  /**
   * Returns all tasks in the specified task list.
   *
   * @param $tasklist   string Task list identifier.
   * @param $completedMax   string Upper bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.
   * @param $completedMin   string Lower bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.
   * @param $dueMax   string Upper bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.
   * @param $dueMin   string Lower bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.
   * @param $maxResults   integer Maximum number of task lists returned on one page. Optional. The default is 100.
   * @param $pageToken   string Token specifying the result page to return. Optional.
   * @param $showCompleted   boolean Flag indicating whether completed tasks are returned in the result. Optional. The default is True.
   * @param $showDeleted   boolean Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.
   * @param $showHidden   boolean Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.
   * @param $updatedMin   string Lower bound for a task's last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time.
   */
  public function listTasks($tasklist,
        $completedMax = null,
        $completedMin = null,
        $dueMax = null,
        $dueMin = null,
        $maxResults = null,
        $pageToken = null,
        $showCompleted = null,
        $showDeleted = null,
        $showHidden = null,
        $updatedMin = null) {
    return $this->tasks->__call('list', array(array('tasklist' => $tasklist,
        'completedMax' => $completedMax,
        'completedMin' => $completedMin,
        'dueMax' => $dueMax,
        'dueMin' => $dueMin,
        'maxResults' => $maxResults,
        'pageToken' => $pageToken,
        'showCompleted' => $showCompleted,
        'showDeleted' => $showDeleted,
        'showHidden' => $showHidden,
        'updatedMin' => $updatedMin)));
  }

  /**
   * Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks.
   *
   * @param $task   string Task identifier.
   * @param $tasklist   string Task list identifier.
   * @param $postBody 
   * @param $parent   string New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.
   * @param $previous   string New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.
   */
  public function moveTasks($task,
        $tasklist,
        $postBody,
        $parent = null,
        $previous = null) {
    return $this->tasks->__call('move', array(array('task' => $task,
        'tasklist' => $tasklist,
        'postBody' => $postBody,
        'parent' => $parent,
        'previous' => $previous)));
  }

  /**
   * Updates the specified task.
   *
   * @param $task   string Task identifier.
   * @param $tasklist   string Task list identifier.
   * @param $postBody 
   */
  public function updateTasks($task,
        $tasklist,
        $postBody) {
    return $this->tasks->__call('update', array(array('task' => $task,
        'tasklist' => $tasklist,
        'postBody' => $postBody)));
  }

  /**
   * @return the $io
   */
  public function getIo() {
    return $this->io;
  }

  /**
   * @return the $version
   */
  public function getVersion() {
    return $this->version;
  }

  /**
   * @return the $restBasePath
   */
  public function getRestBasePath() {
    return $this->restBasePath;
  }

  /**
   * @return the $rpcPath
   */
  public function getRpcPath() {
    return $this->rpcPath;
  }
}

